using System;

namespace System.Resources.SqlResource
{
    class CSUtil
    {
        private readonly string _MngClassSqlServer;

        public CSUtil()
        { 
            _MngClassSqlServer = System.Configuration.ConfigurationManager.AppSettings["MngClassSqlServer"];
        }

        public ISqlResourceGetData CreateInstance()
        {
            Reflection.Assembly a = System.Reflection.Assembly.LoadFile(_MngClassSqlServer);
            ISqlResourceGetData s = null;

            foreach (Type t in a.GetTypes())
            {
                if (t.GetInterface(typeof(ISqlResourceGetData).FullName) != null)
                {
                    s = (ISqlResourceGetData)Activator.CreateInstance(t);
                }
            }

            return s;
        }
    }
}
